package com.vo;

import com.bean.dangBean.Consumer;

import java.io.Serializable;

public class ConsumerVo implements Serializable {
    /** 用户编号 */
    private String id;
    /** 用户账号 */
    private String userName;
    /** 用户密码 */
    private String phone;
    /** 用户姓名 */
    private String address;
    /** 用户性别 */
    private String sex;

    public ConsumerVo() {
    }

    public ConsumerVo(String userName, String phone, String address, String sex) {
        this.userName = userName;
        this.phone = phone;
        this.address = address;
        this.sex = sex;
    }

    public ConsumerVo(String id, String userName, String phone, String address, String sex) {
        this.id = id;
        this.userName = userName;
        this.phone = phone;
        this.address = address;
        this.sex = sex;
    }
    public Consumer parse(){

        Consumer consumer = new Consumer();

        try {
            consumer.setId(Integer.valueOf(this.id));
        } catch (Exception e) {
//            e.printStackTrace();
        }
        try {
            consumer.setSex(Integer.valueOf(this.sex));
        } catch (Exception e) {
//            e.printStackTrace();
        }


        consumer.setUserName(this.userName);
        consumer.setPhone(this.phone);
        consumer.setAddress(this.address);

        return consumer;
    }

    @Override
    public String toString() {
        return "ConsumerVo{" +
                "id='" + id + '\'' +
                ", userName='" + userName + '\'' +
                ", phone='" + phone + '\'' +
                ", address='" + address + '\'' +
                ", sex='" + sex + '\'' +
                '}';
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }
}
